Skip to content

feat(review): dispatch revision-aware reviews by exact head - #36

Merged
777genius merged 1 commit into
mainfrom
fix/review-dispatch-workflow
Jul 23, 2026
Merged

feat(review): dispatch revision-aware reviews by exact head#36
777genius merged 1 commit into
mainfrom
fix/review-dispatch-workflow

Conversation

@777genius

@777genius 777genius commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • dispatch durable review intents through workflow_dispatch with an exact head SHA
  • fail closed on ambiguous manual rerun fallback and cancel provider work when the PR revision moves
  • rebuild the committed Action runtime bundle

Verification

  • npm run lint
  • npm run typecheck
  • npm test -- --runInBand (1728 passed)
  • npm run build
  • workflow YAML parsed by Prettier

Summary by CodeRabbit

  • New Features

    • Added the /rr review command for requesting a manual review.
    • Review requests now target the current pull request revision, helping prevent actions on outdated code.
    • Added support for manual review requests from dispatched workflows.
  • Bug Fixes

    • Prevented fallback workflow reruns when manual review availability is uncertain.
    • Active reviews now stop when the pull request revision changes.
    • Busy review processing waits and retries without consuming unnecessary attempts.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The changes add durable review-head SHA handling to reusable workflows, introduce control-plane manual review requests for interaction commands, support workflow-dispatch event parsing, and make T0 orchestration retry leases and abort provider execution when the review revision changes.

Changes

Revision-aware review flow

Layer / File(s) Summary
Durable revision propagation
.github/workflows/reviewrouter-*.yml, src/codex-oauth/action.ts, __tests__/unit/codex-oauth/action-mode.test.ts
Workflows accept and validate review_head_sha, forward it to T0 execution, check out the exact revision, and expose it to runtime event parsing.
Manual review control plane
src/control-plane/review-request.ts, src/github/interaction.ts, src/main.ts, __tests__/unit/control-plane/*, __tests__/unit/github/*
Manual review, skip, and unskip commands submit revision-aware requests with availability handling, API outcome mapping, authorization, and fallback notices.
Revision-safe T0 execution
src/review-orchestration/application/run-t0-review-orchestration.ts, __tests__/unit/review-orchestration/*
Lease acquisition uses bounded exponential backoff, and active provider invocations are aborted when revision monitoring detects supersession.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Poem

A rabbit checks the SHA in the rain,
Queues review hops down a new control-plane lane.
T0 leases wait, then providers take flight,
Until a changed revision says, “Not tonight!”
The lease is released; the burrow sleeps tight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: revision-aware review dispatch by exact head SHA.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/review-dispatch-workflow

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
.github/workflows/reviewrouter-execution-reusable.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'

.github/workflows/reviewrouter-reusable.yml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@777genius
777genius merged commit 8e4ef41 into main Jul 23, 2026
2 of 3 checks passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/reviewrouter-execution-reusable.yml:
- Around line 220-228: Align the T0 checkout step named “Checkout exact T0
review revision” with the runtime input’s SHA precedence: use the same resolved
commit value for both checkout ref and runtime validation/input, preferring the
live pull request head SHA when operating on a live PR and otherwise using
inputs.review_head_sha. Preserve exact-head consistency so checkout and runtime
never target different revisions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 025299b7-a843-47eb-8b77-29dd6eddbaac

📥 Commits

Reviewing files that changed from the base of the PR and between 852297e and c804fe9.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (11)
  • .github/workflows/reviewrouter-execution-reusable.yml
  • .github/workflows/reviewrouter-reusable.yml
  • __tests__/unit/codex-oauth/action-mode.test.ts
  • __tests__/unit/control-plane/review-request.test.ts
  • __tests__/unit/github/interaction.test.ts
  • __tests__/unit/review-orchestration/run-t0-review-orchestration.test.ts
  • src/codex-oauth/action.ts
  • src/control-plane/review-request.ts
  • src/github/interaction.ts
  • src/main.ts
  • src/review-orchestration/application/run-t0-review-orchestration.ts

Comment on lines +220 to +228
- name: Checkout exact T0 review revision
if: ${{ inputs.review_action_lane == 't0' && steps.runtime.outputs.can_run == 'true' }}
uses: actions/checkout@v6
with:
ref: ${{ inputs.review_head_sha }}
persist-credentials: false

- name: Checkout pull request code
if: ${{ steps.runtime.outputs.can_run == 'true' }}
if: ${{ inputs.review_action_lane == 'legacy' && steps.runtime.outputs.can_run == 'true' }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Inspect how review_head_sha is supplied by callers of the reusable workflows.
rg -nP -C3 'review_head_sha' .github/workflows

Repository: 777genius/review-router

Length of output: 5584


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== relevant files =="
git ls-files .github/workflows/reviewrouter-execution-reusable.yml .github/workflows/reviewrouter-reusable.yml

echo
echo "== reviewer execution workflow outline/context =="
wc -l .github/workflows/reviewrouter-execution-reusable.yml
sed -n '1,90p' .github/workflows/reviewrouter-execution-reusable.yml
sed -n '200,240p' .github/workflows/reviewrouter-execution-reusable.yml
sed -n '320,345p' .github/workflows/reviewrouter-execution-reusable.yml

echo
echo "== reusable workflow inputs and runtime env =="
sed -n '1,60p' .github/workflows/reviewrouter-reusable.yml
sed -n '90,130p' .github/workflows/reviewrouter-reusable.yml
sed -n '140,190p' .github/workflows/reviewrouter-reusable.yml

echo
echo "== usages of reviewer execution workflow in repo (text diff context) =="
python3 - <<'PY'
from pathlib import Path
import re
for p in sorted(Path('.github').rglob('*.yml')) + sorted(Path('.github').rglob('*.yaml')):
    b = p.read_text(errors='ignore')
    if 'reviewrouter-execution-reusable.yml' in b:
        lines=b.splitlines()
        print(f'--- {p} ---')
        for i,l in enumerate(lines,1):
            if 'reviewrouter-execution-reusable.yml' in l or 'review_head_sha' in l:
                a=max(1,i-4); z=min(len(lines),i+4)
                for j in range(a,z+1):
                    print(f'{j:4}: {lines[j-1]}')
                print()
PY

Repository: 777genius/review-router

Length of output: 16319


Use the same SHA for the T0 checkout and runtime input.

The T0 tree is checked out at inputs.review_head_sha, but the runtime input prefers the live github.event.pull_request.head.sha. If a PR advances after the T0 workflow is queued, inputs.review_head_sha stays at the older durable value while the runtime can receive/validate the newer head, breaking the exact-head durability guarantee. Align the checkout ref with the runtime input precedence, or pass github.event.pull_request.head.sha to both when operating on a live PR.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/reviewrouter-execution-reusable.yml around lines 220 -
228, Align the T0 checkout step named “Checkout exact T0 review revision” with
the runtime input’s SHA precedence: use the same resolved commit value for both
checkout ref and runtime validation/input, preferring the live pull request head
SHA when operating on a live PR and otherwise using inputs.review_head_sha.
Preserve exact-head consistency so checkout and runtime never target different
revisions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant